<style type="text/css">
.labelhide .layui-form-label{display:none;}
.layui-form-label{width:90px;}
.layui-input-block {margin-left:120px;}
form{margin-right:20px;margin-top:10px;}
.layui-form-item{margin-bottom:10px;}
.logic .layui-form-label{padding:9px 3px;width:70px;}
.logic .layui-input-block{margin-left:86px;}
.layui-laydate-header{padding:0px 0px 0px 0px;}
.layui-laydate-list{padding:0px;}
.layui-laydate-content{padding:0px;}
.dm-sort{width: 60px!important;height: 26px;}
.menu-dl1 dl{float: left}
.size_name_select{float: left}
.dm-font{}
.layui-form-radio{margin:0!important;}
</style>
<form class="layui-form"  method="post" id="editForm">
    <input type="hidden" id="adressID" value="{$address_id}">
    <br>
    {:FormExt::select('*请选择标签','id','', $new_list,'','','lay-filter="addAdress"')}

    <div class="htmlnei" style="width: 400px;">
        <dl class="menu-dl1">
            <dt>1、断码情况 <span style="color: red">(勾选代表，显示大标签及多标签同时展示)</span></dt>
            <dt >
                <div ><input type="radio" class="duanma_flag_0" name="break_code_up" value="" title="" {if $info['break_code_up'] ==0 } checked {/if} > <span class="dm-font"> 无</span> </div>
                <div ><input type="radio" class="duanma_flag_1" name="break_code_up" value="1" title=""  {if $info['break_code_up'] ==1 } checked {/if}> <span class="dm-font"> 正常</span> </div>
                <div ><input type="radio" class="duanma_flag_3" name="break_code_up" value="3" title="" {if $info['break_code_up'] ==3 } checked {/if} > <span class="dm-font"> 已断码</span> </div>
                <div ><input type="radio" class="duanma_flag_2" name="break_code_up" value="2" title="" {if $info['break_code_up'] ==2 } checked {/if} > <span class="dm-font"> 将断码</span> </div>
            </dt>
            <dt>2、单类<span style="color: red">(勾选代表，显示大标签及多标签同时展示)</span></dt>
            <dt>
                <div ><input type="radio" class="order_flag_" name="order_type_up" value="" title="" {if $info['order_type_up'] =='' } checked {/if} > <span class="dm-font">无</span> </div>
                <div ><input type="radio" class="order_flag_new" name="order_type_up" value="new" title="" {if $info['order_type_up'] =="new" } checked {/if} > <span class="dm-font"> 首单</span> </div>
                <div ><input type="radio" class="order_flag_normal" name="order_type_up" value='normal' title="" {if $info['order_type_up'] =="normal" } checked {/if} > <span class="dm-font"> 返单</span> </div>
                <div ><input type="radio" class="order_flag_my_return_first" name="order_type_up" value="my_return_first" title="" {if $info['order_type_up'] =="my_return_first" } checked {/if}> <span class="dm-font"> 初返</span> </div>
                <div ><input type="radio" class="order_flag_my_first" name="order_type_up" value='my_first'  {if $info['order_type_up'] =="my_first" } checked {/if}> <span class="dm-font"> 第一次</span> </div>
                <div ><input type="radio" class="order_flag_emergent"  name="order_type_up" value="emergent"  {if $info['order_type_up'] =="emergent" } checked {/if} > <span class="dm-font"> 紧急单</span> </div>
            </dt>
            <dt>3、滚动速度</dt>
            <dt>
                <span class="dm-font"> 滚动速度：</span> <input type="text" class="layui-input dm-sort" name="speed_seting"  value="{$info['speed_seting']}" ><span style="color:red">(单位秒，滚动速度默认5秒,可以是负数)</span>
            </dt>
        </dl>
    </div>
    <div class="pop-bottom-bar">
        <input type="hidden" name='lable_ID' id="lable_ID" value="{$info.id}">
        <button type="submit" class="layui-btn layui-btn-normal" id="submitShow" lay-submit="" >提交保存</button>
        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
    </div>
</form>

<script type="text/html" id="setingTemplate">


</script>

{include file="system@block/layui" /}
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js"></script>
<script>
    layui.use(['form', 'func','laydate','colorpicker','laytpl'], function() {
        var $ = layui.jquery, form = layui.form,laydate=layui.laydate,colorpicker = layui.colorpicker,laytpl = layui.laytpl;

		//监听提交
		form.on('select(addAdress)', function(data){

            $.ajax({
                type: "POST",
                url: "{:url('addSmallLabel')}?id="+data.value,
                data: '',
                dataType:"json",
                success: function(res){
                    $('.menu-dl1 input[name="break_code_up"]').prop('checked',false);
                    $('.menu-dl1 input[name="order_type_up"]').prop('checked',false);
                    $('.duanma_flag_'+res.data.break_code_up).prop('checked',true);
                    $('.order_flag_'+res.data.order_type_up).prop('checked',true);
                    $('.dm-sort').attr('value',res.data.speed_seting);
                    $('#lable_ID').attr('value',res.data.id);
                    layui.form.render()
                }
            });
		});
         // form.on('submit(formSubmit)', function(data){
        $(document).on('click',"#submitShow", function() {
            var label_name= $('.field-id').val();
            var break_code_up= $('.menu-dl1 input[name="break_code_up"]:checked').val();
            var order_type_up= $('.menu-dl1 input[name="order_type_up"]:checked').val();
            var speed_seting=$('.dm-sort').val();
            var lable_ID=$('#lable_ID').val();
            var  adressID=$('#adressID').val();
            if(speed_seting== ''){
                layer.msg('请填写滚动速度！', {icon: 2,anim: 6});
                return false;
            }
            if(label_name==''){
                layer.msg('标签名为空，请选择！', {icon: 2,anim: 6});
                return  false;
            }
            $.post("{:url('addSmallLabel')}", {lable_ID:lable_ID,break_code_up:break_code_up,order_type_up:order_type_up,speed_seting:speed_seting}, function (res) {
                if (res.code == 1) {
                    layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.location.href="{:url('index')}?address_id="+adressID;
                    });
                } else {
                    layer.msg(res.msg, {time: 1800, icon: 2},function () {
                        // window.location.reload();
                        parent.location.href="{:url('index')}?address_id="+adressID;
                    });

                }
                layui.form.render()
            }, 'json');

            return false;
        });

        // 刷新当前页
        window.reloadTable = function () {
            var that = $("#hisi-table-search"),
                arr = that.serializeArray(),
                where = new Array(),
                dataTable = that.attr('data-table') ? that.attr('data-table') : 'dataTable',
                currPage = $(".layui-laypage-em").next().html(),
                options = new Function('return '+ that.attr('hisi-data'))() || {page: {curr:currPage}};
            for(var i in arr) {
                where[arr[i].name] = arr[i].value;
            }
            options.url = that.attr('action');
            options.where = where;

            opTable.reload(options);
            return false;
        }

    });
</script>